
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>车险批改</title>
    <%@include file="common.jsp"%>
    <script >
        $(function () {
            $("#search_panel").panel({
                title:"高级查询面板",
                fit:true
            });

            $("#orderBill_datagrid").datagrid({
                height:350,
                rownumbers:true,
                singleSelect:true,
                pagination:true,
                url:'/orderBill/selectBill?orderBillStatus=3',
                fitColumns:true,
                columns:[
                    [
                        {field:'ck',checkbox:true},
                        {field:'id',align:'center',width:100,title:'申请单号'},
                        {field:'org_organizationName',align:'center',width:200,title:'承保机构'},
                        {field:'insureBillNumber',align:'center',width:200,title:'投保单号'},
                        {field:'status',align:'center',width:200,title:'保单状态',formatter:statusFormatter},
                        {field:'apl_realname',align:'center',width:100,title:'投保人'},
                        {field:'carPlateNumber',align:'center',width:180,title:'车牌号'},
                        {field:'wittingDate',align:'center',width:180,title:'申请时间'},
                        {field:'p_name',align:'center',width:180,title:'产品名称'},
                        {field:'ri_temp',align:'center',width:180,title:'批改状态',formatter:riFormatter}
                    ]
                ]
            });
            $("a[data-cmd]").on("click",function(){
                //获取表单 高级查询条件, 封装到 qo中, 并且重新加载 datagrid
                var organizationNameD = $("[name=organizationNameD]").val();
                var insureBillNumberD = $("[name=insureBillNumberD]").val();
                var productName = $("[name=productName]").val();
                var carPlateNumberD = $("[name=carPlateNumberD]").val();
                var aplicantName = $("[name=aplicantName]").val();
                var recognizeeNameD = $("[name=recognizeeNameD]").val();
                var inputBeginDateD = $("[name=inputBeginDateD]").val();
                var inputEndDateD = $("[name=inputEndDateD]").val();
                $("#orderBill_datagrid").datagrid("load",{
                    organizationNameD:organizationNameD,
                    insureBillNumberD:insureBillNumberD,
                    productName:productName,
                    carPlateNumberD:carPlateNumberD,
                    aplicantName:aplicantName,
                    recognizeeNameD:recognizeeNameD,
                    inputBeginDateD:inputBeginDateD,
                    inputEndDateD:inputEndDateD,
                    orderBillStatus:3
                });
            });
            $("#reason_panel").panel({
                title:"批改原因"
            });

        });
        function reload() {
            $("#orderBill_datagrid").datagrid("reload");
        }
        function revise() {
            var rowdata = $("#orderBill_datagrid").datagrid("getSelected");
            var reasonValue = $("#salectedReason").val();
            if(reasonValue == -1){
                $.messager.alert("温馨提示","请选择需要批改原因.","warning");
            }
            if(rowdata){
                window.location.href="/reviseinfo/revise?orderBillId="+rowdata.id + "&reasonValue=" + reasonValue;
            }else{
                $.messager.alert("温馨提示","请选择需要批改的保单记录.","warning");
            }
        }
        //查看核保意见
        function review() {
            var rowdata = $("#orderBill_datagrid").datagrid("getSelected");
            $("#suggestions_dialog").dialog('open');
            $.post("/underWriting/querySuggestions?orderBillId="+rowdata.id,function (data) {
                if(data){
                    $("#suggestion_form").form("load",data);
                }
            },'json');
        }
        function statusFormatter(value,record,index){
            if(value==3){
                return "<font color='green'>待批改</font>";
            }else{
                return "<font color='red'>非待批改保单穿越啦</font>";
            }
        }
        function riFormatter(value,record,index) {
            if(value==1){
                return "<font color='red'>批改暂存</font>";
            }else {
                return "<font color='orange'>未批改</font>";
            }
        }
    </script>
</head>
<body>
<div id="search_panel" >
        <form id="search_form" method="post">
            <table style="margin-left: 200px">
                <tr>
                    <td><select name="organizationNameD" class="easyui-combobox"
                         data-options="label:'机构部门:',labelPosition:'before',prompt:'请选择机构部门', width:250,
                         valueField:'id',textField:'organizationName',url:'/organization/selectList'"/></td>
                    <td><input name="insureBillNumberD" class="easyui-textbox" data-options="label:'保单号:',labelPosition:'before',prompt:'请输入保单号', width:250"></td>
                </tr>
                <tr>
                    <td><select name="productName" class="easyui-combobox"
                               data-options="label:'产品:',labelPosition:'before',prompt:'请选择产品名称', width:250,
                               valueField:'id',textField:'name',url:'/product/selectList'"/></td>
                    <td><input name="carPlateNumberD" class="easyui-textbox" data-options="label:'车牌号码:',labelPosition:'before',prompt:'请输入保单号', width:250"></td>
                </tr>
                <tr>
                    <td><input name="aplicantName" class="easyui-textbox" data-options="label:'投保人:',labelPosition:'before',prompt:'投保人名称', width:250"></td>
                    <td><input name="recognizeeNameD" class="easyui-textbox" data-options="label:'被保人:',labelPosition:'before',prompt:'被保人名称', width:250"></td>
                </tr>
                <tr>
                    <td>
                    <input name="inputBeginDateD" class="easyui-datebox" data-options="label:'申请日期:',labelPosition:'before',width:250"/>
                    ~<input name="inputEndDateD" class="easyui-datebox" data-options="width:180"/></td>
                </tr>
            </table>
            <div align="right">
                <a class="easyui-linkbutton" iconCls="icon-search" data-options="text:'查询'" iconCls="icon-search" data-cmd="search"></a>
                <a class="easyui-linkbutton" iconCls="icon-reload" data-options="text:'刷新'" onclick="reload()"></a>
            </div>
        </form>

    <div id="orderBill_datagrid"></div>
    <div id="reason_panel">
        <table>
            <tr>
                <td><a class="easyui-linkbutton" iconCls="icon-search" data-options="text:'查看批改原因'" onclick="review()"></a></td>
                <td><select id="salectedReason" name="reviseReason" class="easyui-combobox"
                            data-options="label:'批改类型:',labelPosition:'before', width:350 ">
                    <option value="0">请选择</option>
                    <option value="1">车辆信息批改</option>
                    <option value="2">投保人信息批改</option>
                </select></td>
            </tr>
        </table>
    </div>
    <div >
        <a class="easyui-linkbutton" data-options="width:100" onclick="revise()">进入批改</a>
    </div>
    <dev id="suggestions_dialog" class="easyui-dialog" data-options="title:'核保意见',closable:'true',closed:'true'">
        <form id="suggestion_form">
            <input class="easyui-textbox" name="suggestions" data-options="label:'核保意见:',labelPosition:'before',labelWidth:80 ,width:350,height:100"/>
        </form>
    </dev>
</div>
</body>
</html>
